//
//  ViewController.m
//  TestMVVMWine
//
//  Created by 吴志勇 on 2020/3/27.
//  Copyright © 2020 wzy. All rights reserved.
//

#import "ViewController.h"
#import "WineView.h"
#import "DataModelView.h"

@interface ViewController ()

/*  */
@property (nonatomic, strong) WineView *wineView;

/*  */
@property (nonatomic, strong) DataModelView *modelView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor redColor];
    [self setUpUI];
    
    [self dealThing];
}


//
- (void)dealThing{
    self.modelView.click = ^(NSString * _Nonnull indexStr) {
        NSLog(@"%@",indexStr);
    };
}

- (void)setUpUI{
    [self.view addSubview:self.wineView];
    
   
}

- (WineView *)wineView{
    if (_wineView == nil) {
        WineView *wineView = [[WineView alloc] initWithFrame:CGRectMake(0 ,0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height - 40)];
        wineView.tableView.delegate = self.modelView;
        wineView.tableView.dataSource = self.modelView;
        _wineView = wineView;
    }
    return _wineView;
}

- (DataModelView *)modelView{
    if (_modelView == nil) {
        _modelView = [[DataModelView alloc] init];
    }
    return _modelView;
}


@end
